package com.ruoyi.demo.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.demo.service.ITestWebSocketService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @作者：xie
 * @时间：2022/9/18 22:58
 */


@RequiredArgsConstructor
@RestController
@RequestMapping("/demo/websocket")
@Slf4j
public class TestWebSocketController {

    private final ITestWebSocketService iTestWebSocketService;



    @GetMapping("/sendMessageByWebSocket")
    public R<Void> sendMessageByWebSocket(@RequestParam(value = "userNames",required=false)List<String> userNames,
                                          String title,
                                          String content,
                                          String sendUserName) {
        iTestWebSocketService.sendMessageByWebSocket(userNames, title, content,sendUserName);
        return R.ok();
    }

}
